
// Definition for singly-linked list.
function ListNode(val) {
    this.val = val;
    this.next = null;
}

/**
 * @param {ListNode} head
 * @return {number[]}
 */
var reversePrint = function(head) {
  let result = [], temp = head;
  while(temp) {
    result.push(temp.val);
    temp = temp.next;
  }
  return result.reverse();
};
